namespace PMS.Common
{
    using System;
    using System.IO;
    using System.Net;
    using System.Text;

    public class IPHelper
    {
        public static string GetIP()
        {
            Uri requestUri = new Uri(Config.GetIPUrl);
            Stream responseStream = WebRequest.Create(requestUri).GetResponse().GetResponseStream();
            StreamReader reader = new StreamReader(responseStream, Encoding.Default);
            string str2 = reader.ReadToEnd();
            int startIndex = str2.IndexOf("[") + 1;
            int index = str2.IndexOf("]", startIndex);
            string str3 = str2.Substring(startIndex, index - startIndex);
            reader.Close();
            responseStream.Close();
            return str3;
        }
    }
}

